<?php

namespace App\Models\Headquarters;

use Illuminate\Database\Eloquent\Model;
use Log;
/**
 * author 叶文华
 * IEC104 恩倍力垃圾抓斗
 */
class GrabGarbage extends Model
{
    protected $table = 'grab_garbage_yongqiang1';
    protected $fillable = ['allsn', 'sn', 'time', 'che', 'dou', 'liao', 'code', 'lost', 'hev'];

    protected $casts = [
        'created_at' => 'datetime:Y-m-d H:i:s',
        'updated_at' => 'datetime:Y-m-d H:i:s'
    ];

    public function __construct(array $attributes = [])
    {
        parent::__construct($attributes);
    }

    public function insertOne($params){
        return self::create($params);
    }

    public function insertMany($params){
        return self::insert($params);
    }

    public function findRowBySn($sn){
        return self::where('sn', $sn)->first();
    }

    public function findRowByTime($start, $end){
        return self::where('time', '>=', $start)->where('time', '<=', $end)->first();
    }
}


